<template>
  <div class="header">
    <van-nav-bar
      :title="title"
      left-text="返回"
      :right-text="rightBtn"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
  </div>
</template>

<script>
export default {
  // 接受父组件传递的数据
  props: {
    title: {
      type: String,
      default: '智慧小巷',
    },
    rightBtn: {
      type: String,
      default: '',
    },
  },
  data() {
    return {}
  },

  methods: {
    onClickLeft() {
      this.$router.go(-1)
    },
    onClickRight() {
      // 子组件传递的事件
      this.$emit('updataInfo')
    },
  },

  components: {},
}
</script>

<style scoped>
.header {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 0 !important;
  position: fixed;
  top: 0;
  z-index: 999;
}
</style>
